package com.gxa.meiye.admin.platform.controller;


import com.gxa.meiye.admin.platform.pojo.domain.Shop;
import com.gxa.meiye.admin.platform.pojo.vo.SettleVo;
import com.gxa.meiye.admin.platform.pojo.vo.UpdateUserStatusVo;
import com.gxa.meiye.admin.platform.pojo.vo.UserVo;
import com.gxa.meiye.admin.platform.service.SettleService;
import com.gxa.meiye.core.common.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api
@RestController
@RequestMapping("/platform/settle")
public class SettleController {

    @Autowired
    private SettleService settleService;

    @ApiOperation("入驻审核列表")
    @GetMapping("/list")
    public Map list(){
        List<SettleVo> settleVos = settleService.selectSettleList();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setData(settleVos);
        return jsonResult.getMap();
    }


    @ApiOperation("同意入驻")
    @PostMapping("/agree")
    public Map agree(Integer id){
        settleService.agree(id);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        return jsonResult.getMap();
    }

    @ApiOperation("拒绝入驻")
    @PostMapping("/reject")
    public Map reject(Integer id){
        settleService.reject(id);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        return jsonResult.getMap();
    }

    @ApiOperation("查询入驻审核")
    @PostMapping("/selectSettle")
    public Map selectSettle(String select){
        List<SettleVo> settleVos = settleService.selectSettles(select);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setData(settleVos);
        return jsonResult.getMap();
    }

    @ApiOperation("详情页")
    @PostMapping("/more")
    public Map more(Integer id){
        Shop shop = settleService.selectSettle(id);
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setData(shop);
        return jsonResult.getMap();
    }
}
